#include<cstdio>
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;bool f=false;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x = (x<<1) + (x<<3) + (ch^48); ch = getchar(); }
	x = f ? -x : x;
	return ;
}

struct node{
	*node next[2];
	node() { next[1] = next[0] = nullptr; }
};
struct Trie{
	node U[1000010],*ALL=U;
	node root;

	node* ALLOC() { return new(*ALL++)node(); }

	void push(int x)
	{
		node *now = &root;
		for(int i=1;i<=32;++i)
		{
			int k = x & 1;
			x>>=1;
			if(now->next[k] == nullptr)
			{
				now->next[k] = ALLOC();
				now = now->next[k];
			}
			else
				now = now->next[k];
		}

		return ;
	}

	int find_mx(int x)
	{
		int temp=0;
		node *now = &root;
		for(int i=1;i<=32;++i)
		{
			int k = x & 1;
			x>>=1;
			if(now->next[k ^ 1] != nullptr)
			{
				temp<<=1;
				temp += 1;
				now = now->next[k^1];
			}
			else
			{
				temp<<=1;
				if(now->next[k] == nullptr)
				{

				}
			}
		}
	}
}

int n;
int line[100010];
Trie T;

int main()
{
	int ans=0,x;
	read(n);
	for(int i=1;i<=n;++i)
	{
		read(line[i]);
		T.push(line[i]);
		ans = std::max(ans, T.find_mx(line[i]));
	}

	printf("%d",ans);
	return 0;
}
